//
//  NSDate+Jeask.m
//  Created by ti on 15/8/2.
//  Copyright (c) 2015年 ti. All rights reserved.


#import "NSDate+Jeask.h"

@implementation NSDate (Jeask)


-(NSString *)inquireDateStringWithReturnType:(JeaskDateType)type
{
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    NSString *returnType = [NSString new];
    switch (type) {
        case YMdHms:
        {
            returnType = @"YYYY-MM-dd HH:mm:ss";
        }
            break;
        case YMd:
        {
            returnType = @"YYYY-MM-dd";
        }
            break;
        case Md:
        {
            returnType = @"MM-dd";
        }
            break;
        case YM:
        {
            returnType = @"YYYY-MM";
        }
            break;
        case ms:
        {
            returnType = @"mm:ss";
        }
            break;
        case Hm:
        {
            returnType = @"HH:mm";
        }
            break;
        case MdHm:
        {
            returnType = @"MM-dd HH:mm";
        }
            break;
        default:
            break;
    }
    [formatter setDateFormat:returnType];
    return [formatter stringFromDate:self];
}

-(NSString *)inquireDateStringWithCustomType:(NSString *)type
{
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:type];
    return [formatter stringFromDate:self];
}

@end
